import { IconSun, IconCloud, IconCloudRain, IconCloudSnow } from '@tabler/icons-react';

export function getWeatherIcon(code: string) {
    return code ? IconSun : IconSun;
    // switch (code) {
    //     return IconSun;
    // case 'clear':
    //     return <IconSun className="text-yellow-500" />;
    // case 'clouds':
    //     return <IconCloud className="text-gray-500" />;
    // case 'rain':
    //     return <IconCloudRain className="text-blue-500" />;
    // case 'snow':
    //     return <IconCloudSnow className="text-blue-300" />;
    // default:
    //     return <IconCloud className="text-gray-500" />;
    // }
}

export function kelvinToCelsius(kelvin: number): number {
    return Math.round(kelvin - 273.15);
}

export function celsiusToFahrenheit(celsius: number): number {
    return Math.round((celsius * 9 / 5) + 32);
}

export function formatWindDirection(degrees: number): string {
    const directions = ['北', '东北', '东', '东南', '南', '西南', '西', '西北'];
    const index = Math.round(degrees / 45) % 8;
    return directions[index];
}